
function timedRefresh(timeoutPeriod) {
	setTimeout("location.reload(true);",timeoutPeriod);
}

$(function() {
	$("input.delete").click(function() {
		$this = $(this);
		$id = $this.parent().parent().attr("id");
		
		$form = $("#" + $id);
		$delete = $("#delete_" + $id);
		$($delete).val(1);
		
		$form.ajaxSubmit({
			dataType: 'json',
			success: function(data) {
				if (data.error) {
					alert(data.error);
				}

				$form.remove();
				timedRefresh(500);
			}
		});
		
		
	});
});

